using System;
using System.Collections.Generic;
using Top.Api.Response;
using Top.Api.Util;

namespace Top.Api.Request
{
    /// <summary>
    /// TOP API: taobao.poster.posters.search
    /// </summary>
    public class PosterPostersSearchRequest : ITopRequest<PosterPostersSearchResponse>
    {
        /// <summary>
        /// 频道id列表
        /// </summary>
        public string ChannelIds { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public Nullable<DateTime> EndDate { get; set; }

        /// <summary>
        /// 关键词出现在标题，短标题，标签中
        /// </summary>
        public string KeyWord { get; set; }

        /// <summary>
        /// 当前页
        /// </summary>
        public Nullable<long> PageNo { get; set; }

        /// <summary>
        /// 每页显示画报数 小于10或者大于20，默认设置为10
        /// </summary>
        public Nullable<long> PageSize { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public Nullable<DateTime> StartDate { get; set; }

        #region ITopRequest Members

        public string GetApiName()
        {
            return "taobao.poster.posters.search";
        }

        public IDictionary<string, string> GetParameters()
        {
            TopDictionary parameters = new TopDictionary();
            parameters.Add("channel_ids", this.ChannelIds);
            parameters.Add("end_date", this.EndDate);
            parameters.Add("key_word", this.KeyWord);
            parameters.Add("page_no", this.PageNo);
            parameters.Add("page_size", this.PageSize);
            parameters.Add("start_date", this.StartDate);
            return parameters;
        }

        public void Validate()
        {
            RequestValidator.ValidateMaxListSize("channel_ids", this.ChannelIds, 20);
            RequestValidator.ValidateMaxLength("channel_ids", this.ChannelIds, 100);
            RequestValidator.ValidateRequired("page_no", this.PageNo);
            RequestValidator.ValidateRequired("page_size", this.PageSize);
        }

        #endregion
    }
}
